# -*- coding: utf-8 -*-
# @Time    : 2021/4/19 0019 9:59
# @Author  : 蒋才果
# @Email   : 1476235300@qq.com
# @File    : atm.py
# @Software: PyCharm
def atm_login():
    print('输入1进入登录界面')
    print('输入q退出')
    a = input()
    if a == '1':
        login()
    if a == 'q':
        exit()
# atm_login()

def func_atm():
    a = input('wqeqw:')
    if a == '2':
        quqian()
    elif a == '3':
        cun()
    elif a == '4':
        cha()
    elif a == 'q':
        exit()
    func_atm()

def login():
    ls = [('root','123456')]
    username = input('输入用户名')
    passwd = input("输入密码：")
    if (username,passwd) in ls:
        print("登录成功".center(50,'*'))
        func_atm()
    else:
        print("登录失败")

c = 0
def cun():
    global money1
    global c
    money1 = int(input("输入你要存入的金额："))
    c += money1
    print("本次你存储",money1,"账户余额为",c)
    func_atm()


def quqian():
    global money
    money = int(input("输入你要取出的钱："))
    if money > c:
        print("账户余额不足以你取",money)
    else:
        print(f'你本次取出{money}，余额为{c - money}')
    func_atm()

def cha():
      print('余额为：',c)
      func_atm()

atm_login()